import 'package:animal/constant/color.dart';
import 'package:animal/constant/font.dart';
import 'package:animal/item/mine_option_item.dart';
import 'package:animal/ui/friend/controller/add_friend_controller.dart';
import 'package:animal/utils/screen_util.dart';
import 'package:animal/widgets/PageStateWidget.dart';
import 'package:animal/widgets/appbar_widget.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getwidget/getwidget.dart';

///添加好友
class AddFriendPage extends StatelessWidget {
  AddFriendPage({Key? key}) : super(key: key);
  final controller = Get.put(AddFriendController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBarWidget.defaultAppBar(title: const Text("添加好友"), elevation: 0, backgroundColor: Colors.white),
      body: Column(
        children: [
          Row(
            children: [
              Expanded(
                child: Container(
                  margin: EdgeInsets.only(left: ScreenUtil().L(30)),
                  padding: EdgeInsets.only(left: ScreenUtil().L(20)),
                  decoration: BoxDecoration(
                    color: KColorConstant.textFieldBgColor,
                    borderRadius: BorderRadius.circular(ScreenUtil().L(10))
                  ),
                  child: TextField(
                    style: KFontConstant.myTextStyle(size: 15),
                    controller: controller.textEditingController,
                    maxLength: 20,
                    maxLines: 1,
                    decoration: InputDecoration(
                      hintText: "多多号/手机号",
                      hintStyle: KFontConstant.myTextStyle(size: 15, color: KColorConstant.black999999),
                      border: InputBorder.none,
                      counterText: "",
                    ),
                  ),
                ),
              ),
              GFButton(
                onPressed: () =>controller.searchUser(search: controller.textEditingController.text),
                text: "搜索",
                textStyle: KFontConstant.myTextStyle(size: 17, color: Colors.blue),
                type: GFButtonType.transparent,
              )
            ],
          ),
          MineOptionItem(name: "扫一扫",onTap: (){}),
          PageStateWidget.stateWidget(
            pageStatue: controller.pageState.value,
            contentWidget: Container(),
          )
        ],
      ),
    );
  }
}
